﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="zh-CN">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title>登录 | smart</title>
  <link href="/SmartCommunity/css/pc/bootstrap.css" rel="stylesheet">
  <link rel="stylesheet" href="/SmartCommunity/css/pc/application-49d5e02c.css" />
</head>
<body class="account" id="login">
  <ul class="bg-slideshow">
    <li>
      <span>Image 01</span>
    </li>
    <li>
      <span>Image 02</span>
    </li>
    <li>
      <span>Image 03</span>
    </li>
    <li>
      <span>Image 04</span>
    </li>
    <li>
      <span>Image 05</span>
    </li>
  </ul>
    <div class="login-modal">
    <div class="login-modal-dialog">
      <div class="login-onboard">
          <div class="login-modal-dialog-heading">
              <a title="回到主页" id="login-logo">SMART</a>
          </div>
         <div class="login-modal-dialog-form">
              <form class="form-sign"">
                  <div class="form-group ob-input-w-icon">
                      <i><span class="glyphicon glyphicon-user" aria-hidden="true"></span></i>
                      <input type="text" id="phone"class="form-control" name="phone" placeholder="手机号" required="required" autofocus="autofocus" />
                  </div>
                  <div class="form-group ob-input-w-icon">
                      <i><span class="glyphicon glyphicon-lock" aria-hidden="true"></span></i>
                      <input type="password"id="password" class="form-control" name="password" placeholder="密码" required="required" />
                  </div>
                  <button class="btn btn-primary btn-block" type="button" onclick="check()">登录</button>
              </form>              
          </div>
      </div>
    </div>
  </div>
    <script src="/SmartCommunity/js/pc/jquery.js"></script>
  <script>
	  function check(){
	  var phone=$("#phone").val();
	  var regu = /^[1][0-9][0-9]{9}$/;
	  var re = new RegExp(regu);
	  	if (!re.test(phone)) { 
	  		alert("请输入合法的手机号");
	  		$("#phone").focus();
	  		return false;
	  	}
	  var password=$("#password").val();
	  $.ajax({
		    type:"POST",
		    cache: false,
			url: "/SmartCommunity/pc/login_check",
			//contentType: "application/json; charset=utf-8",
			dataType: "text",
			data:{phone:phone,password:password},
			success: function(data) 
			{
			 if(data=="true") window.location.href="/SmartCommunity/views/pc/smart.html";
			 else             alert("用户名或者密码错误");
			 },
			 error: function(res){
			 var obj = eval(res);
		     window.location.href="/SmartCommunity/views/pc/login.html";
			} 
		}); 
  return false;
  }
  </script>
</body>
</html>
